﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>宾果高校</title>
    <link rel="stylesheet" href="/static/css/styles.css">
    <link rel="stylesheet" href="/static/css/sweetalert.min.css" />
    <link rel="stylesheet" href="/static/css/jquery.datetimepicker.css" />
    <link rel="stylesheet" href="/static/js/simditor/styles/simditor.css" />
    <link rel="stylesheet" href="/static/js/simditor/styles/simditor-html.css" />
    <link rel="stylesheet" href="/static/css/jquery-validate.css" />
    <style>
        #simple {
            width: 1000px;
            border: 1px solid #ddd;
        }

        .progress {
            width: 300px;
            height: 3px;
            border-radius: 10px;
            border: 1px solid blue;
        }

        .up-file-content {
            float: none;
            color: red;
        }

        .companyFilter {
            margin-bottom: 0;
            margin-top: 0;
            display: inline-block;
        }

        .form-group .form-group-remark {
            display: block;
            border: 1px solid #F2524A;
            border-radius: 50%;
            color: #F2524A;
            text-align: center;
            width: 22px;
            height: 22px;
            font-size: 14px;
            line-height: 20px;
            margin-left: 10px;
        }
    </style>
</head>
<body class="release">
    <div id="divHeader"></div>
    <div class="main">
        <div class="container">
            <div class="crumb">

            </div>
            <div style="margin-top: 20px;" class="title">
                <h2>发布赞助书</h2>
            </div>
            <div class="release-module">
                <div class="wrap">
                    <div class="title">
                        <h3>基本信息</h3>
                    </div>
                    <form id="formContent">
                        <div class="form-association-name pr form-group clearfix">
                            <label for="ass-activity">活动名称</label>
                            <div class="form_control fl big">
                                <input type="text" id="ProjectName" data-tip="请输入活动名称" data-valid="isNonEmpty" data-error="请输入活动名称" class="pr50 required">
                            </div>
                            <span class="ass-insideVal">0/40</span>
                        </div>
                        <div id="divArea" class="filter pr companyFilter">
                            <ul class="filter-choose">
                                <li>
                                    <span>活动地区：</span>
                                    <a href="javascript:void(0)" name="Area" value="" class="chosen">不限</a>
                                    <a href="javascript:void(0)" name="Area" value="300000">广州市</a>
                                    <a href="javascript:void(0)" name="Area" value="300005">深圳市</a>
                                    <a href="javascript:void(0)" name="Area" value="300009">东莞市</a>
                                    <a href="javascript:void(0)" name="Area" value="300001">汕头市</a>
                                    <a href="javascript:void(0)" name="Area" value="300002">湛江市</a>
                                    <a href="javascript:void(0)" name="Area" value="300003">潮州市</a>
                                    <a href="javascript:void(0)" name="Area" value="300004">茂名市</a>
                                    <a href="javascript:void(0)" name="Area" value="300006">韶关市</a>
                                    <a href="javascript:void(0)" name="Area" value="300007">梅州市</a>
                                    <a href="javascript:void(0)" name="Area" value="300008">惠州市</a>
                                    <a href="javascript:void(0)" name="Area" value="300010">江门市</a>
                                    <a href="javascript:void(0)" name="Area" value="300011">佛山市</a>
                                    <a href="javascript:void(0)" name="Area" value="300012">肇庆市</a>
                                    <a href="javascript:void(0)" name="Area" value="300013">珠海市</a>
                                    <a href="javascript:void(0)" name="Area" value="300014">中山市</a>
                                    <a href="javascript:void(0)" name="Area" value="300016">汕尾市</a>
                                    <a href="javascript:void(0)" name="Area" value="300017">阳江市</a>
                                    <a href="javascript:void(0)" name="Area" value="300018">清远市</a>
                                    <a href="javascript:void(0)" name="Area" value="300019">揭阳市</a>
                                    <a href="javascript:void(0)" name="Area" value="300020">云浮市</a>
                                    <!--<a id="showMoreArea" href="javascript:;" class="main-color">更多</a>-->
                                </li>
                                <!--<div class="more-area">
                                    <a href="javascript:void(0)" name="Area" value="300008">惠州市</a>
                                    <a href="javascript:void(0)" name="Area" value="300010">江门市</a>
                                    <a href="javascript:void(0)" name="Area" value="300011">佛山市</a>
                                    <a href="javascript:void(0)" name="Area" value="300012">肇庆市</a>
                                    <a href="javascript:void(0)" name="Area" value="300013">珠海市</a>
                                    <a href="javascript:void(0)" name="Area" value="300014">中山市</a>
                                    <a href="javascript:void(0)" name="Area" value="300016">汕尾市</a>
                                    <a href="javascript:void(0)" name="Area" value="300017">阳江市</a>
                                    <a href="javascript:void(0)" name="Area" value="300018">清远市</a>
                                    <a href="javascript:void(0)" name="Area" value="300019">揭阳市</a>
                                    <a href="javascript:void(0)" name="Area" value="300020">云浮市</a>
                                </div>-->
                            </ul>
                        </div>
                        <ul class="radio clearfix">
                            <li>活动类型：</li>
                            <li>
                                <a href="javascript:void(0)" name="ActivityType" value="900000040" class="chosen">招新类</a>
                                <a href="javascript:void(0)" name="ActivityType" value="900000041">文艺类</a>
                                <a href="javascript:void(0)" name="ActivityType" value="900000042">表演类</a>
                                <a href="javascript:void(0)" name="ActivityType" value="900000043">晚会类</a>
                                <a href="javascript:void(0)" name="ActivityType" value="900000044">体育类</a>
                                <a href="javascript:void(0)" name="ActivityType" value="900000045">讲座类</a>
                                <a href="javascript:void(0)" name="ActivityType" value="900000046">比赛类</a>
                                <a href="javascript:void(0)" name="ActivityType" value="900000047">其他</a>
                            </li>
                        </ul>
                        <ul class="radio clearfix">
                            <li>活动规模：</li>
                            <li>
                                <a href="javascript:void(0)" name="StudentInterval" value="900000003" tag="0-100" class="chosen">0-100人</a>
                                <a href="javascript:void(0)" name="StudentInterval" value="900000004" tag="101-300">101-300人</a>
                                <a href="javascript:void(0)" name="StudentInterval" value="900000005" tag="301-500">301-500人</a>
                                <a href="javascript:void(0)" name="StudentInterval" value="900000006" tag="501-1000">501-1000人</a>
                                <a href="javascript:void(0)" name="StudentInterval" value="900000007" tag="1001-1500">1001-1500人</a>
                                <a href="javascript:void(0)" name="StudentInterval" value="900000008" tag="1501">1500人以上</a>
                            </li>
                        </ul>
                        <div id="divAddress" class="form-group clearfix">
                            <label for="">活动地点：</label>
                            <div class="form_control fl">
                                <input type="text" id="Address" class="required" data-tip="请输入活动地点" data-valid="isNonEmpty" data-error="请输入活动地点">
                                <p class="assoc-rTips-readme" id="prizeReadme"></p>
                                <span class="intro-tips">指的是在校内的哪个场地举办活动</span>
                        </div>
                        </div>
                        <div class="form-group clearfix">
                            <label for="">赞助金额：</label>
                            <div class="form_control fl">
                                <input type="text" id="Amount" class="required" data-tip="请输入赞助金额" data-valid="isNonEmpty" data-error="请输入赞助金额">
                        </div>
                        </div>
                        <div class="form-group clearfix">
                            <label for="">活动时间：</label>
                            <input type="text" id="StartDate" style="width: 120px;"><span class="fl">—</span>
                            <input type="text" id="EndDate" style="width: 120px;">
                        </div>
                        <div id="divNumber" class="form-group clearfix">
                            <label for="">活动场次：</label>
                            <div class="form_control fl">
                                <input type="text" id="ActivityNum" class="required" data-tip="请输入活动场次" data-valid="isNonEmpty" data-error="请输入活动场次">
                        </div>
                        </div>
                        <ul class="radio clearfix">
                            <li>宣传方式：</li>
                            <li>
                                <a href="javascript:void(0)" name="PublicizeType" value="传统地推模式" class="chosen">传统地推模式</a>
                                <a href="javascript:void(0)" name="PublicizeType" value="新媒体互联网推广">新媒体互联网推广</a>
                                <a href="javascript:void(0)" name="PublicizeType" value="传统地推+新媒体互联网推广">传统地推+新媒体互联网推广</a>
                            </li>
                            <li>
                                <a href="javascript:void(0)" class="main-color introduceTeam">（宣传方式类别介绍）</a>
                                <span class="intro-tips">传统地推模式：以海报、传单与横幅等线下方式作宣传载体<br />新媒体互联网模式：以微博、微信与论坛等线上方式作宣传载体</span>
                            </li>
                        </ul>
                        <ul class="radio clearfix">
                            <li>执行团队：</li>
                            <li>
                                <a href="javascript:void(0)" name="ExecutiveTeam" value="需要" class="chosen">需要</a>
                                <a href="javascript:void(0)" name="ExecutiveTeam" value="不需要">不需要</a>
                            </li>
                            <li>
                                <a href="javascript:void(0)" class="main-color introduceTeam">（执行团队介绍）</a>
                                <span class="intro-tips">执行团队：指活动需聘请校外专业的活动策划及舞美设计执行团队</span>
                            </li>
                        </ul>
                        <div class="form-group clearfix">
                            <label for="">活动紧急联系人姓名：</label>
                            <div class="form_control fl left">
                                <input type="text" id="ContactName" class="required" data-tip="请输入联系人姓名" data-valid="isNonEmpty" data-error="请输入联系人姓名">
                        </div>
                        </div>
                        <div class="form-group clearfix">
                            <label for="">活动紧急联系人电话：</label>
                            <div class="form_control fl left">
                                <input type="text" id="ContactPhone" class="required" data-tip="请输入联系人电话" data-valid="isNonEmpty" data-error="请输入联系人电话">
                        </div>
                        </div>
                        <div class="title">
                            <h3 id="activityGoods">活动所需物资</h3>
                        </div>
                        <div class="campaign-goods">
                            <ul class="clearfix">
                                <li>
                                    <div class="form-group-center clearfix">
                                        <label for="">活动海报：</label><span>张</span>
                                        <input type="text" id="Poster">
                                    </div>
                                    <div class="form-group-center clearfix">
                                        <label for="">麦克风：</label><span>个</span>
                                        <input type="text" id="Microphone">
                                    </div>
                                    <div class="form-group-center clearfix">
                                        <label for="">活动音响：</label><span>个</span>
                                        <input type="text" id="Sound">
                                    </div>
                                </li>
                                <li>
                                    <div id="divProduct" class="form-group-center clearfix">
                                        <label for="">公司产品：</label><span>箱</span>
                                        <input type="text" id="Product">
                                    </div>
                                    <div id="divBooth" class="form-group-center clearfix">
                                        <label for="">活动展位：</label><span>个</span>
                                        <input type="text" id="Booth">
                                    </div>
                                    <div class="form-group-center clearfix">
                                        <label for="">易拉宝：</label><span>个</span>
                                        <input type="text" id="Rollup">
                                    </div>
                                    <div class="form-group-center clearfix">
                                        <label for="">活动桌椅：</label><span>张</span>
                                        <input type="text" id="Desk">
                                    </div>
                                </li>
                                <li>
                                    <div class="form-group-center clearfix">
                                        <label for="">活动KT板：</label><span>张</span>
                                        <input type="text" id="KTBoard">
                                    </div>
                                    <div class="form-group-center clearfix">
                                        <label for="">活动传单：</label><span>张</span>
                                        <input type="text" id="Leaflet">
                                    </div>
                                    <div class="form-group-center clearfix">
                                        <label for="">其它物料：</label>
                                        <input type="text" id="Other">
                                    </div>
                                </li>
                                <li style="margin-right: 0;">
                                    <div class="form-group-center clearfix">
                                        <label for="">活动横幅：</label><span>张</span>
                                        <input type="text" id="Banner">
                                    </div>
                                    <div class="form-group-center clearfix">
                                        <label for="">活动帐篷：</label><span>顶</span>
                                        <input type="text" id="Tent">
                                    </div>
                                </li>
                            </ul>
                        </div>
                        <div class="title">
                            <h3>请填写活动简介</h3>
                        </div>
                        <div class="textarea-block">
                            <!--<textarea name="name" rows="8" placeholder="请输入活动简介..."></textarea>-->
                            <textarea id="Introduction" placeholder="请输入活动简介"></textarea>
                            <!--<div class="content" id="Introduction"></div>-->
                        </div>
                        <div class="title">
                            <h3 id="titleForRole">请填写活动效果承诺</h3>
                        </div>
                        <div class="association-ensure">
                            <ul class="clearfix">
                                <li>
                                    <div class="form-group clearfix">
                                        <label for="">活动照片：</label>
                                        <div class="form_control fl">
                                        <input type="text" id="Photos" class="required" data-tip="请输入活动照片" data-valid="isNonEmpty" data-error="请输入活动照片"></div><span>张</span>
                                        <span class="main-color">*（必填）</span>
                                    </div>
                                </li>
                                <li>
                                    <div class="form-group clearfix">
                                        <label for="">活动视频：</label>
                                        <div class="form_control fl">
                                        <input type="text" id="Video" class="required" data-tip="请输入活动视频" data-valid="isNonEmpty" data-error="请输入活动视频"></div><span>条</span>
                                    </div>
                                </li>
                                <li>
                                    <div class="form-group clearfix">
                                        <label for="">活动推文：</label>
                                        <div class="form_control fl">
                                        <input type="text" id="Tweets" class="required" data-tip="请输入活动推文" data-valid="isNonEmpty" data-error="请输入活动推文"></div><span>篇</span>
                                    </div>
                                </li>
                            </ul>
                        </div>
                        <div class="textarea-block">
                            <!--<textarea name="name" rows="8"></textarea>-->
                            <textarea id="Supervision" placeholder="请输入活动效果承诺"></textarea>
                            <!--<div class="content" id="Supervision"></div>-->
                        </div>

                        <div class="submit text-center">
                            <button type="button" id="nextStep" onclick="Submit('add')">下一步</button>
                            <button type="button" id="btnUpdate" onclick="Submit('update')">提交修改</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
    <div id="divFooter"></div>
    <div class="mask hide"></div>
    <div class="popBox uploadBox hide" id="uploadBox" ng-app="my" ng-controller="AppController" nv-file-drop="" uploader="uploader" filters="queueLimit, customFilter">
        <h1 class="up-header">上传附件<a href="javascript:void(0)" class="up-hb-close" id="up-hb-close">X</a></h1>
        <div class="up-content">
            <div class="up-h-book">
                <h2 class="up-hb-h2">上传策划书</h2>
                <ul class="up-hb-btn clearfix">
                    <li>
                        <a href="javascript:;" class="up-fileBook" id="up-fileBook">
                            上传策划书
                            <input type="file" nv-file-select="" uploader="uploader1" />

                        </a>
                    </li>
                    <li>
                        <h3 class="up-fileNameBook clearfix">
                            <label>已添加附件：</label>

                        </h3>
                        <div class="up-file-content" ng-repeat="item in uploader1.queue">
                            <span>{{ item.file.name }}</span>
                            <div class="loading" style="margin-bottom: 0;">
                                <div class="progress" role="progressbar" ng-style="{ 'width': item.progress + '%' }"></div>{{item.progress}}%
                            </div>
                        </div>
                    </li>
                </ul>
            </div>
            <div class="up-h-book mt10">
                <h2 class="up-hb-h3 pic">上传活动宣传图片<span>(提示:请上传三张往届成功举办活动图片或者本次活动宣传图片，其中一张请命名为cover.jpg,将用于封面展示)</span></h2>
                <ul class="up-hb-btn clearfix">
                    <li>
                        <a href="javascript:;" class="up-fileBook" id="up-filePhoto">
                            上传活动图片
                            <input type="file" name="" multiple="multiple" nv-file-select="" uploader="uploader">
                        </a>
                    </li>
                    <li>
                        <h3 class="up-fileNameBook clearfix">
                            <label>已添加附件：</label>

                        </h3>
                        <div class="up-file-content" ng-repeat="item in uploader.queue">
                            <span>{{ item.file.name }}</span>

                            <div class="progress" role="progressbar" ng-style="{ 'width': item.progress + '%' }"></div>
                            <span></span>

                        </div>

                    </li>
                </ul>
            </div>
            <button type="button" class="up-hb-submit" ng-click="UploadFile()">确认提交</button>
        </div>
    </div>

    <script type="text/javascript" src="/static/js/ref/jquery-2.1.1.min.js"></script>
    <script type="text/javascript" src="/static/js/ref/jquery.datetimepicker.full.min.js"></script>
    <script type="text/javascript" src="/static/js/simditor/scripts/module.min.js"></script>
    <script type="text/javascript" src="/static/js/simditor/scripts/hotkeys.min.js"></script>
    <script type="text/javascript" src="/static/js/simditor/scripts/simditor.min.js"></script>
    <script type="text/javascript" src="/static/js/simditor/scripts/beautify-html.js"></script>
    <script type="text/javascript" src="/static/js/simditor/scripts/simditor-html.js"></script>
    <script type="text/javascript" src="/static/js/self/common.js"></script>
    <script type="text/javascript" src="/static/js/ref/sweetalert.min.js"></script>
    <script type="text/javascript" src="/static/js/ref/angular.min.js"></script>
    <script type="text/javascript" src="/static/js/ref/angular-file-upload.min.js"></script>
    <script src="/static/js/self/jquery-validate.js"></script>
    <script>
        common.validator($('form'));
        var userInfo = common.GetUser();
        var jsonUserInfo = JSON.parse(userInfo);
        if (jsonUserInfo.UserType === 1) {
            $('#activityGoods').html('活动提供物资');
            $('#titleForRole').html('活动效果要求');
            $('#Supervision').attr("placeholder", "活动效果要求");


        } else if (jsonUserInfo.UserType == 2) {
            $('#activityGoods').html('活动所需物资');
            $('#titleForRole').html('请填写活动效果承诺');
            $('#Supervision').attr("placeholder", "请输入活动效果承诺");

        }

        $("#divHeader").load("/wuc/header.html");
        $("#divFooter").load("/wuc/footer.html");

        common.checkBeforeLeave();

        var hasFinished = false;

        function AfterActived(ctx) {

            if (ctx == null) {

                common.alertMessage("无数据.");
                return;
            }

            window.location = "/release-detail.html?id=" + projectID;

        }

        angular.module('my', ['angularFileUpload']).controller('AppController', ['$scope', 'FileUploader', function ($scope, FileUploader) {
            var uploader = $scope.uploader = new FileUploader();
            var uploader1 = $scope.uploader1 = new FileUploader();

            uploader.filters.push({
                name: 'customFilter',
                fn: function (item, options) {
                    var type = '|' + item.type.slice(item.type.lastIndexOf('/') + 1) + '|';
                    if ('|jpg|png|jpeg|bmp|gif|'.indexOf(type.toLowerCase()) == -1)
                        return false;

                    if (this.queue.length > 2)
                        this.queue[0].remove();
                    return true;
                }
            });
            uploader1.filters.push({
                name: 'customFilter',
                fn: function (item, options) {
                    this.clearQueue();
                    return true;
                }
            });

            $scope.UploadFile = function () {
                var coverCount = 0;
                var flag2 = false;
                var flag1 = false;
                var flagSize = false;
                var bookSize = false;
                uploader.queue.forEach(function (e) {

                    if (e.file.size > 1000000) {
                        flagSize = true;
                        return;
                    }
                    if (e.file.name.toLowerCase() == 'cover.jpg' || e.file.name.toLowerCase() == 'cover.jpeg' || e.file.name.toLowerCase() == 'cover.png')
                        coverCount++;
                })
                uploader1.queue.forEach(function (e) {
                    if (e.file.size > 8000000) {
                        bookSize = true;
                       
                        return;
                    }
                    if (e.file.name.toLowerCase() == 'cover.jpg' || e.file.name.toLowerCase() == 'cover.jpeg' || e.file.name.toLowerCase() == 'cover.png')
                        coverCount++;
                })
                if (bookSize) {
                    common.alertMessage("策划书不能超过8M");
                    return;
                }
                if (flagSize) {
                    common.alertMessage("图片大小不能超过1M");
                    return;

                }
                if (coverCount > 1) {
                    common.alertMessage("只能有一张cover.jpg的图片作为封面");
                    return;
                }
                else if (coverCount == 0) {
                    common.alertMessage("请选择一张cover.jpg的图片作为封面");
                    return;
                }
                if (uploader.queue.length != 3) {
                    flag2 == false;
                    common.alertMessage("没有上传三张图片")
                    return;
                }
                if (uploader1.queue.length != 1) {
                    flag1 == false;
                    common.alertMessage("没有上传策划书")
                    return;
                }
                uploader.queue.forEach(function (e) {
                    e.url = "/api/project/UploadFile?type=ActImg&projectID=" + window.projectID
                })
                uploader1.queue.forEach(function (e) {
                    e.url = "/api/project/UploadFile?type=SponsorBook&projectID=" + window.projectID
                })

                uploader.uploadAll();
                uploader1.url = '/api/project/UploadFile?type=SponsorBook&projectID=' + projectID;
                uploader1.uploadAll();

                //uploader.onCompleteItem = function (item, response, status) {
                //    debugger;
                //    alert(status);
                //}

                uploader.onCompleteAll = function () {
                    if (hasFinished) {
                        common.commonAjax({ type: 'Get', url: '/api/project/ActiveProject?id=' + projectID, sMethod: AfterActived });
                    }
                    else {
                        hasFinished = true;
                    }
                }

                uploader1.onCompleteAll = function () {
                    if (hasFinished) {
                        common.commonAjax({ type: 'Get', url: '/api/project/ActiveProject?id=' + projectID, sMethod: AfterActived });
                    }
                    else {
                        hasFinished = true;
                    }
                }

                uploader.onErrorItem = function () {
                    hasFinished = false;
                    common.alertMessage("文件上传失败，请重新上传");
                }

                uploader1.onErrorItem = function () {
                    hasFinished = false;
                    common.alertMessage("文件上传失败，请重新上传");
                }
            }
        }]);

        var userType = common.GetUserType();
        switch (userType) {
            case 1:
                $("#divAddress").hide();
                $("#divNumber").hide();
                $("#divBooth").hide();
                break;
            case 2:
                $("#divArea").hide();
                $("#divProduct").hide();
                break;
            default:
                window.location = "/index.html";
        }

        var param = common.getUrlArgStr();
        if (common.checkValue(param.id)) {
            $("#nextStep").hide();
            common.commonAjax({ type: 'Get', url: '/api/project/get?id=' + param.id + '&type=Project', sMethod: AfterGetProject });
        }
        else {
            $("#btnUpdate").hide();
        }

        function AfterGetProject(ctx) {
            if (ctx == null) {
                common.alertMessage("无数据.");
                return;
            }

            var obj = ctx.ResponseDict;
            for (var name in obj) {
                switch (name) {
                    case "Introduction":
                    case "Supervision":
                        name == "Supervision" ? supervision.setValue(obj[name]) : introduction.setValue(obj[name])
                        break;
                    case "PublicizeType":
                    case "ExecutiveTeam":
                    case "ActivityType":
                    case "StudentInterval":
                    case "Area":
                        $("a[name=" + name + "]").each(function () {
                            var objThis = $(this);
                            var val = name == "PublicizeType" || name == "ExecutiveTeam" || name == "Area" ? objThis.attr("value") : name == "ActivityType" ? objThis.text() : objThis.attr("tag");
                            objThis.removeClass("chosen");
                            if (val == obj[name])
                                objThis.addClass("chosen");
                        })

                        break;
                    default:
                        $("#" + name).val(obj[name]);
                        break;
                }
            }
        }

        function AfterCompleted(ctx) {

            if (ctx == null) {

                common.alertMessage("无数据.");
                return;
            }

            if (actionType == "add") {
                if (!common.checkValue(window.projectID))
                    window.projectID = ctx.ResponseStr.toString();

                $(".mask").show();
                $("#uploadBox").show();
            }
            else
                window.location = "/release-detail.html?id=" + param.id;

        }

        var introduction, supervision, actionType;

        function Submit(type) {
            var values = common.GetCtrlValues({
                ContentID: "formContent"
            })
            //判断表单
            if(!$("#formContent").validate('submitValidate')){
                return false;
            }

            if (isNaN(values.Amount)) {
                common.alertMessage("赞助金额只允许输入数字");
                return;
            }

            if (values.Amount < 500) {
                common.alertMessage("赞助金额不能小于500");
                return;
            }

            //判断时间
            var $StartDate = $("#StartDate");
            var $EndDate = $("#EndDate");
            if($StartDate.val() == "" || $EndDate.val() == ""){
                common.alertMessage("请选择活动时间");
                return;
            }else if(($EndDate.val().replace("-","/") < $StartDate.val().replace("-","/")) && $EndDate.val() != ""){
                common.alertMessage("活动结束时间必须大与开始时间");
                return;
            }

            //判断textarea
            var $introduction = $("#Introduction");
            if ($introduction.val() == "") {
                common.alertMessage("请输入活动简介");
                return;
            }
            var Supervision = $("#Supervision");
            if (Supervision.val() == "") {
                common.alertMessage("请输入活动效果承诺");
                return;
            }

            values.Introduction = introduction.getValue();
            values.Supervision = supervision.getValue();

            if (values.Introduction.length > 5900 || values.Supervision.length > 5900) {
                common.alertMessage("活动简介或者效果字数不允许超过6000");
                return;
            }

            var ctrl;

            actionType = type;

            if (type == "update") {
                ctrl = "UpdateProject";
                values.ID = param.id;
            }
            else if (type == "add" && common.checkValue(window.projectID)) {
                ctrl = "UpdateProject";
                values.ID = window.projectID;
            }
            else
                ctrl = "CreateProject";

            common.commonAjax({ type: 'Post', url: '/api/project/' + ctrl, data: values, sMethod: AfterCompleted });
        }

        $(function () {
            //登录框下拉
            $('.link-login').on('click', function (e) {
                var self = $(this);
                self.parent().siblings().find('a').removeClass('on');
                self.toggleClass('on');
            });

            //选择地区
            $(".radio li a").on('click', function (e) {
                var self = $(this);
                self.siblings().removeClass('chosen');
                self.addClass('chosen');
            });

            //选择地区
            $(".filter-choose li a").on('click', function (e) {
                var self = $(this);
                self.siblings().removeClass('chosen');
                self.addClass('chosen');
            });

            $("#up-hb-close").on('click', function (e) {
                $("#uploadBox").hide();
                $(".mask").hide();
            });

            $.datetimepicker.setLocale('ch');//设置语言
            $('#StartDate').datetimepicker({
                timepicker: false,
                format: 'Y-m-d',
                onChangeDateTime:function(dp,$input){
                    var $EndDate = $("#EndDate");
                    if(($EndDate.val().replace("-","/") < $input.val().replace("-","/")) && $EndDate.val() != ""){
                        $EndDate.val("");
                        common.alertMessage("活动结束时间必须大与开始时间");
                    }
                }
            });
            $('#EndDate').datetimepicker({
                timepicker: false,
                format: 'Y-m-d',
                onChangeDateTime:function(dp,$input){
                    var $startDate = $("#StartDate");
                    if(($input.val().replace("-","/") < $startDate.val().replace("-","/")) && $input.val() != ""){
                        $input.val("");
                        common.alertMessage("活动结束时间必须大与开始时间");
                    }
                }
            });

            introduction = common.CreateEditor('Introduction');

            supervision = common.CreateEditor('Supervision');
        });
    </script>
</body>
</html>